package com.hzjh.base.frame.activity

import android.os.Bundle
import androidx.viewbinding.ViewBinding
import com.hzjh.base.frame.BaseViewModel
import com.hzjh.base.style.weight.ToastKt.toastCenter

abstract class BaseTVMActivity<T : ViewBinding, VM : BaseViewModel> : AbsVMActivity<VM>() {

    protected lateinit var viewBinding: T

    abstract fun initViewBinding(): T

    override fun onCreate(savedInstanceState: Bundle?) {
        viewBinding = initViewBinding()
        super.onCreate(savedInstanceState)
        setContentView(viewBinding.root)

    }

    override fun initObservable() {
        viewModel.errMsg.observe(this) {
            toastCenter(it)
        }
    }
}